package join;


import org.apache.hadoop.io.WritableComparable;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

/*
 * 人员和地址的通用bean
 * 用作map输出的value
 */
public class Bean implements WritableComparable<Bean> {
    private String userNo = " ";
    private String userName = " ";
    private String addreNo = " ";
    private String addreName = " ";

    public Bean(Bean bean) {
        this.userName = bean.getUserName();
        this.userNo = bean.getUserNo();
        this.addreName = bean.getAddreName();
        this.addreNo = bean.getAddreNo();
    }

    public Bean() {
        super();
        // TODO Auto-generated constructor stub
    }

    public Bean(String userNo, String userName, String addreNo,
                String addreName, int flag) {
        super();
        this.userNo = userNo;
        this.userName = userName;
        this.addreNo = addreNo;
        this.addreName = addreName;
    }


    public String getUserNo() {
        return userNo;
    }

    public void setUserNo(String userNo) {
        this.userNo = userNo;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getAddreNo() {
        return addreNo;
    }

    public void setAddreNo(String addreNo) {
        this.addreNo = addreNo;
    }

    public String getAddreName() {
        return addreName;
    }

    public void setAddreName(String addreName) {
        this.addreName = addreName;
    }

    @Override
    public void write(DataOutput out) throws IOException {
        out.writeUTF(userNo);
        out.writeUTF(userName);
        out.writeUTF(addreNo);
        out.writeUTF(addreName);

    }

    @Override
    public void readFields(DataInput in) throws IOException {
        this.userNo = in.readUTF();
        this.userName = in.readUTF();
        this.addreNo = in.readUTF();
        this.addreName = in.readUTF();
    }

    @Override
    public int compareTo(Bean arg0) {
        return 0;
    }

    @Override
    public String toString() {
        return "userNo=" + userNo + ", userName=" + userName + ", addreNo="
                + addreNo + ", addreName=" + addreName;
    }
}

